From ca642cce6d9b7a9dfd2df7e0794e71e7fee8529f Mon Sep 17 00:00:00 2001 From: robertlipe Date: Sun, 10 Feb 2013 03:38:11 +0000 Subject: [PATCH] Fix use-after-free of temp in gbfile. That gets Ubuntu back to a happy place. --- gpsbabel/gbfile.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gpsbabel/gbfile.cc b/gpsbabel/gbfile.cc index 2cbd8edbb..376d2b2c8 100644 --- a/gpsbabel/gbfile.cc +++ b/gpsbabel/gbfile.cc @@ -28,6 +28,7 @@ #include #include #include +#include #if __WIN32__ @@ -779,9 +780,11 @@ gbfputs(const char* s, gbfile* file) int gbfputs(const QString& s, gbfile* file) { - const char* qs = s.toUtf8().data(); + const char* qs = xstrdup(s.toUtf8().data()); unsigned int l = strlen(qs); - return gbfwrite(qs, 1, l, file); + int rv = gbfwrite(qs, 1, l, file); + xfree(qs); + return rv; } /* -- 2.30.2